<?php
/**
 * Created by 项目.
 * User: xuguopeng
 * Date: 6/2/21
 * Time: 8:53 PM
 */

namespace app\api\model;


use think\model\concern\SoftDelete;

class ProductOrder extends BaseModel
{
    use SoftDelete;

    // 关联
    public function content()
    {
        return $this->hasMany('ProductOrderContent','product_order_id','id')->order('id desc');
    }

    public function user()
    {
        return $this->belongsTo('User','user_id','id');
    }

    // 店面信息
    public function store()
    {
        return $this->belongsTo('Store','store_id','id');
    }

    public function getPayTimeAttr($value)
    {
        if($value) {
            return date('Y-m-d H:i:s',$value);
        }
    }
}